<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <title>Administration</title>

    <!-- Bootstrap -->
    <link href="<?php echo base_url();?>/assets/css/bootstrap.css" rel="stylesheet">
    
    <!-- SB Admin CSS - Include with every page -->
    <link href="<?php echo base_url();?>/assets/css/sb-admin.css" rel="stylesheet">
    <link href="<?php echo base_url();?>/assets/css/font-awesome/css/font-awesome.css" rel="stylesheet">
    
    <!-- HTML5 Shim and Respond.js IE8 support of HTML5 elements and media queries -->
    <!-- WARNING: Respond.js doesn't work if you view the page via file:// -->
    <!--[if lt IE 9]>
      <script src="https://oss.maxcdn.com/libs/html5shiv/3.7.0/html5shiv.js"></script>
      <script src="https://oss.maxcdn.com/libs/respond.js/1.4.2/respond.min.js"></script>
    <![endif]-->
	
        
    <!-- jQuery (necessary for Bootstrap's JavaScript plugins) -->
    <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.0/jquery.min.js"></script>
    <script src="http://code.jquery.com/jquery-migrate-1.2.1.js"></script>
    <!-- Include all compiled plugins (below), or include individual files as needed -->
    <script src="<?php echo base_url();?>/assets/js/bootstrap.js"></script>
    <script src="<?php echo base_url();?>/assets/js/jquery.metismenu.js"></script>
    <script src="<?php echo base_url();?>/assets/js/sb-admin.js"></script>
    
  </head>
  <body>

    <div id="wrapper">

        <nav class="navbar navbar-default navbar-fixed-top" role="navigation" style="margin-bottom: 0">
            <div class="navbar-header">
                <button type="button" class="navbar-toggle" data-toggle="collapse" data-target=".sidebar-collapse">
                    <span class="sr-only">Toggle navigation</span>
                    <span class="icon-bar"></span>
                    <span class="icon-bar"></span>
                    <span class="icon-bar"></span>
                </button>
                <a class="navbar-brand" href="<?php echo base_url() ?>admin/">Administration</a>
            </div>
            <!-- /.navbar-header -->

            <ul class="nav navbar-top-links navbar-right">
                <li class="dropdown">
                    <a class="dropdown-toggle" data-toggle="dropdown" href="#">
                        <i class="fa fa-envelope fa-fw"></i>  <i class="fa fa-caret-down"></i>
                    </a>
                    <ul class="dropdown-menu dropdown-messages">
                        <li>
                            <a href="#">
                                <div>
                                    <strong>John Smith</strong>
                                    <span class="pull-right text-muted">
                                        <em>Yesterday</em>
                                    </span>
                                </div>
                                <div>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Pellentesque eleifend...</div>
                            </a>
                        </li>
                        <li class="divider"></li>
                        <li>
                            <a href="#">
                                <div>
                                    <strong>John Smith</strong>
                                    <span class="pull-right text-muted">
                                        <em>Yesterday</em>
                                    </span>
                                </div>
                                <div>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Pellentesque eleifend...</div>
                            </a>
                        </li>
                        <li class="divider"></li>
                        <li>
                            <a href="#">
                                <div>
                                    <strong>John Smith</strong>
                                    <span class="pull-right text-muted">
                                        <em>Yesterday</em>
                                    </span>
                                </div>
                                <div>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Pellentesque eleifend...</div>
                            </a>
                        </li>
                        <li class="divider"></li>
                        <li>
                            <a class="text-center" href="#">
                                <strong>Read All Messages</strong>
                                <i class="fa fa-angle-right"></i>
                            </a>
                        </li>
                    </ul>
                    <!-- /.dropdown-messages -->
                </li>
                <!-- /.dropdown -->
                <li class="dropdown">
                    <a class="dropdown-toggle" data-toggle="dropdown" href="#">
                        <i class="fa fa-tasks fa-fw"></i>  <i class="fa fa-caret-down"></i>
                    </a>
                    <ul class="dropdown-menu dropdown-tasks">
                        <li>
                            <a href="#">
                                <div>
                                    <p>
                                        <strong>Task 1</strong>
                                        <span class="pull-right text-muted">40% Complete</span>
                                    </p>
                                    <div class="progress progress-striped active">
                                        <div class="progress-bar progress-bar-success" role="progressbar" aria-valuenow="40" aria-valuemin="0" aria-valuemax="100" style="width: 40%">
                                            <span class="sr-only">40% Complete (success)</span>
                                        </div>
                                    </div>
                                </div>
                            </a>
                        </li>
                        <li class="divider"></li>
                        <li>
                            <a href="#">
                                <div>
                                    <p>
                                        <strong>Task 2</strong>
                                        <span class="pull-right text-muted">20% Complete</span>
                                    </p>
                                    <div class="progress progress-striped active">
                                        <div class="progress-bar progress-bar-info" role="progressbar" aria-valuenow="20" aria-valuemin="0" aria-valuemax="100" style="width: 20%">
                                            <span class="sr-only">20% Complete</span>
                                        </div>
                                    </div>
                                </div>
                            </a>
                        </li>
                        <li class="divider"></li>
                        <li>
                            <a href="#">
                                <div>
                                    <p>
                                        <strong>Task 3</strong>
                                        <span class="pull-right text-muted">60% Complete</span>
                                    </p>
                                    <div class="progress progress-striped active">
                                        <div class="progress-bar progress-bar-warning" role="progressbar" aria-valuenow="60" aria-valuemin="0" aria-valuemax="100" style="width: 60%">
                                            <span class="sr-only">60% Complete (warning)</span>
                                        </div>
                                    </div>
                                </div>
                            </a>
                        </li>
                        <li class="divider"></li>
                        <li>
                            <a href="#">
                                <div>
                                    <p>
                                        <strong>Task 4</strong>
                                        <span class="pull-right text-muted">80% Complete</span>
                                    </p>
                                    <div class="progress progress-striped active">
                                        <div class="progress-bar progress-bar-danger" role="progressbar" aria-valuenow="80" aria-valuemin="0" aria-valuemax="100" style="width: 80%">
                                            <span class="sr-only">80% Complete (danger)</span>
                                        </div>
                                    </div>
                                </div>
                            </a>
                        </li>
                        <li class="divider"></li>
                        <li>
                            <a class="text-center" href="#">
                                <strong>See All Tasks</strong>
                                <i class="fa fa-angle-right"></i>
                            </a>
                        </li>
                    </ul>
                    <!-- /.dropdown-tasks -->
                </li>
                <!-- /.dropdown -->
                <li class="dropdown">
                    <a class="dropdown-toggle" data-toggle="dropdown" href="#">
                        <i class="fa fa-bell fa-fw"></i>  <i class="fa fa-caret-down"></i>
                    </a>
                    <ul class="dropdown-menu dropdown-alerts">
                        <li>
                            <a href="#">
                                <div>
                                    <i class="fa fa-comment fa-fw"></i> New Comment
                                    <span class="pull-right text-muted small">4 minutes ago</span>
                                </div>
                            </a>
                        </li>
                        <li class="divider"></li>
                        <li>
                            <a href="#">
                                <div>
                                    <i class="fa fa-twitter fa-fw"></i> 3 New Followers
                                    <span class="pull-right text-muted small">12 minutes ago</span>
                                </div>
                            </a>
                        </li>
                        <li class="divider"></li>
                        <li>
                            <a href="#">
                                <div>
                                    <i class="fa fa-envelope fa-fw"></i> Message Sent
                                    <span class="pull-right text-muted small">4 minutes ago</span>
                                </div>
                            </a>
                        </li>
                        <li class="divider"></li>
                        <li>
                            <a href="#">
                                <div>
                                    <i class="fa fa-tasks fa-fw"></i> New Task
                                    <span class="pull-right text-muted small">4 minutes ago</span>
                                </div>
                            </a>
                        </li>
                        <li class="divider"></li>
                        <li>
                            <a href="#">
                                <div>
                                    <i class="fa fa-upload fa-fw"></i> Server Rebooted
                                    <span class="pull-right text-muted small">4 minutes ago</span>
                                </div>
                            </a>
                        </li>
                        <li class="divider"></li>
                        <li>
                            <a class="text-center" href="#">
                                <strong>See All Alerts</strong>
                                <i class="fa fa-angle-right"></i>
                            </a>
                        </li>
                    </ul>
                    <!-- /.dropdown-alerts -->
                </li>
                <!-- /.dropdown -->
                <li class="dropdown">
                    <a class="dropdown-toggle" data-toggle="dropdown" href="#">
                        <i class="fa fa-user fa-fw"></i>  <i class="fa fa-caret-down"></i>
                    </a>
                    <ul class="dropdown-menu dropdown-user">
                        <li><a href="<?php echo base_url();?>admin/user/read/<?php echo $userId; ?>"><i class="fa fa-user fa-fw"></i> User Profile</a>
                        </li>
                        <li><a href="#"><i class="fa fa-gear fa-fw"></i> Settings</a>
                        </li>
                        <li class="divider"></li>
                        <li><a href="<?php echo base_url()?>auth/logout"><i class="fa fa-sign-out fa-fw"></i> Logout</a>
                        </li>
                    </ul>
                    <!-- /.dropdown-user -->
                </li>
                <!-- /.dropdown -->
            </ul>
            <!-- /.navbar-top-links -->

            <div class="navbar-default navbar-static-side" role="navigation">
                <div class="sidebar-collapse">
                    <ul class="nav" id="side-menu">
                        <li class="sidebar-search">
                            <div class="input-group custom-search-form">
                                <input type="text" class="form-control" placeholder="Search...">
                                <span class="input-group-btn">
                                <button class="btn btn-default" type="button">
                                    <i class="fa fa-search"></i>
                                </button>
                            </span>
                            </div>
                            <!-- /input-group -->
                        </li>
                        <li>
                            <a href="<?php echo base_url() ?>admin/"><i class="fa fa-dashboard fa-fw"></i> Dashboard</a>
                        </li>
                        <li>
                            <a href="#"><i class="fa fa-file-text fa-fw"></i> Articles<span class="fa arrow"></span></a>
                            <ul class="nav nav-second-level">
                                <li>
                                    <a href="<?php echo base_url() ?>admin/articlesgeneral/"><i class="fa fa-file fa-fw"></i> Site Articles</a>
                                </li>
                                <li>
                                    <a href="<?php echo base_url() ?>admin/articlescourses/"><i class="fa fa-file fa-fw"></i> Courses Articles</a>
                                </li>
                            </ul>
                        </li>
                        <li>
                            <a href=""><i class="fa fa-users fa-fw"></i> Users<span class="fa arrow"></span></a>  
                            <ul class="nav nav-second-level">
                                <li>
                                    <a href="<?php echo base_url() ?>admin/user/"><i class="fa fa-users fa-fw"></i> List Users</a>
                                </li>
                                <li>
                                    <a href="<?php echo base_url() ?>admin/user_groups/"><i class="fa fa-puzzle-piece fa-fw"></i> User Groups</a>
                                </li>
                            </ul>
                        </li>
                        <li>
                            <a href="<?php echo base_url() ?>admin/classroom/"><i class="fa fa-circle-o fa-fw"></i> Classrooms</a>
                        </li>
                        <li>
                            <a href="<?php echo base_url() ?>admin/course/"><i class="fa fa-book fa-fw"></i> Courses</a>
                        </li>
                        <li>
                            <a href="<?php echo base_url() ?>admin/category/"><i class="fa fa-list fa-fw"></i> Categories</a>
                        </li>
                        <li>
                            <a href="<?php echo base_url() ?>admin/attachment/"><i class="fa fa-paperclip fa-fw"></i> Attachments</a>
                        </li>
                        <li>
                            <a href="<?php echo base_url() ?>admin/comment/"><i class="fa fa-comments-o fa-fw"></i> Comments</a>
                        </li>
                        <li>
                            <a href="<?php echo base_url() ?>admin/testimonial/"><i class="fa fa-quote-left fa-fw"></i> Testimonials</a>
                        </li>
                        <li>
                            <a href="<?php echo base_url() ?>admin/banner/"><i class="fa fa-th-large fa-fw"></i> Banners</a>
                        </li>
                        <li>
                            <a href="<?php echo base_url() ?>admin/slideshow/"><i class="fa fa-picture-o fa-fw"></i> Slideshow</a>
                        </li>
                        <li>
                            <a href="<?php echo base_url() ?>admin/mailinglist/"><i class="fa fa-envelope-o fa-fw"></i> Mailing List Subscribers</a>
                        </li>
                        <li>
                            <a href="#"><i class="fa fa-sitemap fa-fw"></i> Categorized Courses<span class="fa arrow"></span></a>
                            <ul class="nav nav-second-level">
                                <?php foreach($coursesList as $categoryKey => $categoryValue) {
                                    echo "<li>";
                                        echo "<a href='#'>" . $categoryKey . "<span class='fa arrow'></span></a>";
                                            echo "<ul class='nav nav-third-level'>";
                                                foreach($categoryValue as $courseKey => $courseValue) {
                                                    echo "<li>";
                                                        echo "<a href='#'>" . $courseKey . "<span class='fa arrow'></a>";
                                                            echo "<ul class='nav nav-fourth-level'>";
                                                                echo "<li>";
                                                                    echo "<a href='" . base_url() . "admin/articlesByCourse/" . $courseValue['course_id'] . "'><i class='fa fa-file-text fa-fw'></i> Articles</a>";
                                                                echo "</li>";
                                                                echo "<li>";
                                                                    echo "<a href='" . base_url() . "admin/attachmentsByCourse/" .  $courseValue['course_id'] . "'><i class='fa fa-paperclip fa-fw'></i> Attachments</a>";
                                                                echo "</li>";
                                                                echo "<li>";
                                                                    echo "<a href='#'><i class='fa fa-circle-o fa-fw'></i>Classrooms<span class='fa arrow'></a>";
                                                                    echo "<ul class='nav nav-fifth-level'>";
                                                                        echo "<li>";  
                                                                        if(isset($courseValue['classrooms'])) {
                                                                            foreach($courseValue['classrooms'] as $classroomKey => $classroomValue) {
                                                                                echo "<a href='" . base_url() . "admin/usersByClassroom/" . $classroomKey . "'>" . $classroomValue . "</a>";
                                                                            }
                                                                        } else {
                                                                            echo "<span class='text-muted'>No classrooms</span>";
                                                                        }
                                                                        echo "</li>"; 
                                                                    echo "</ul>";
                                                                echo "</li>"; 
                                                            echo "</ul>";
                                                    echo "</li>";
                                                }
                                            echo "</ul>";
                                    echo "</li>";
                                }
                                ?>
                            </ul>
                            <!-- /.nav-second-level -->
                        </li>
                        <li>
                            <a href="#"><i class="fa fa-gear fa-fw"></i> Settings<span class="fa arrow"></span></a>
                            <ul class="nav nav-second-level">
                                <li>
                                    <a href="<?php echo base_url() ?>admin/settings/"><i class="fa fa-gears fa-fw"></i> Site</a>
                                </li>
                                <li>
                                    <a href="<?php echo base_url() ?>admin/contact/"><i class="fa fa-phone-square fa-fw"></i> Contact</a>
                                </li>
                                <li>
                                    <a href="<?php echo base_url() ?>admin/menu/"><i class="fa fa-caret-square-o-down"></i> Menu</a>
                                </li>
                            </ul>
                        </li>

                    </ul>
                    <!-- /#side-menu -->
                </div>
                <!-- /.sidebar-collapse -->
            </div>
            <!-- /.navbar-static-side -->
        </nav>

        <div id="page-wrapper">
            <div class="row">
                <div class="col-lg-12">
                    <h2><?php echo isset($title) ? $title : '' ?></h2>
                </div>
                <!-- /.col-lg-12 -->
            </div>
            <div class="row">
                <div class="col-lg-12">
                    <?php  $this->load->view($template); ?>
                </div>
                <!-- /.col-lg-12 -->
            </div>
            <!-- /.row -->
        </div>
        <!-- /#page-wrapper -->

    </div>
    <!-- /#wrapper -->
    <link href="<?php echo base_url();?>/assets/css/admin-style.css" rel="stylesheet">
    <script type="text/javascript">
        $(document).ready(function () {
            /* Show the selected menu item as bold and expanded if it is a submenu*
             * based on the current url matches the menu item's url
             */
            $("ul.nav").find("a[href='"+window.location.href+"']").each(function () {
                    $(this).parents("ul").addClass("collapse in");
                    $(this).parents("li").addClass("active");
                    $(this).css("font-weight", "bold");
            });
        });
    </script>
  </body>
</html>